#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2018/1/9 0009 10:25
# @Author  : Arliki
# @email   : hkdnxycz@outlook.com
# @File    : logger config File

# hand03 sizi_rollback 10M回滚，最大102个(1G)
# hand04 time_rollback 周四回滚 最大53个(一年)日志
# m
# debug级别以上会存储
# ##调用方法：
# import logging
# import logging.config
# logging.config.fileConfig('logging.conf')
# logger=logging.getLogger('time_roll')
# 使用方法：
# logger.error()

###############################################
[loggers]
keys=root,time_roll,size_roll,no_roll,MysqlError

[logger_root]
level=DEBUG
handlers=hand01,hand02

[logger_size_roll]
handlers=hand01,hand03
qualname=size_roll
propagate=0

[logger_time_roll]
handlers=hand01,hand04
qualname=time_roll
propagate=0

[logger_no_roll]
handlers=hand01,hand02
qualname=no_roll
propagate=0

[logger_MysqlError]
handlers=hand01
qualname=MysqlError
propagate=0
###############################################
[handlers]
keys=hand01,hand02,hand03,hand04

[handler_hand01]
class=StreamHandler
level=INFO
formatter=form02
args=(sys.stderr,)

[handler_hand02]
class=FileHandler
level=DEBUG
formatter=form01
args=('logs/no_roll/error.log', 'a+')

[handler_hand03]
class=handlers.RotatingFileHandler
level=INFO
formatter=form02
args=('logs/size_roll/error.log', 'a+', 10*1024*1024, 102)

[handler_hand04]
class=handlers.TimedRotatingFileHandler
level=INFO
formatter=form01
args=('logs/time_roll/error.log', 'W4',53)
###############################################
[formatters]
keys=form01,form02

[formatter_form01]
format=%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s
datefmt=%Y/%m/%d/%a %H:%M:%S

[formatter_form02]
format=%(name)-12s: %(levelname)-8s %(filename)s[line:%(lineno)d] by %(funcName)s %(message)s
datefmt=